<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>IfExist / IfNotExist</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>IfExist / IfNotExist</h1>

<p>Checks for the existence of a file or folder.</p>

<pre class="Syntax">IfExist, FilePattern
IfNotExist, FilePattern
<a href="FileGetAttrib.htm#attrib">AttributeString</a> := <a href="../Functions.htm#FileExist">FileExist</a>(FilePattern)</pre>
<h3>Parameters</h3>
<dl>

  <dt>FilePattern</dt>
  <dd><p>The path, filename, or file pattern to check. <em>FilePattern</em> is assumed to be in <a href="../Variables.htm#WorkingDir">%A_WorkingDir%</a> if an absolute path isn't specified.</p></dd>

</dl>

<h3>Related</h3>
<p><a href="../Functions.htm#FileExist">FileExist()</a>, <a href="Block.htm">Blocks</a>, <a href="Else.htm">Else</a>, <a href="LoopFile.htm">File-loops</a></p>
<h3>Examples</h3>
<pre class="NoIndent">IfExist, D:\
    MsgBox, The drive exists.
IfExist, D:\Docs\*.txt
    MsgBox, At least one .txt file exists.
IfNotExist, C:\Temp\FlagFile.txt
    MsgBox, The target file does not exist.</pre>

</body>
</html>
